// componets/custom-tab-bar/index.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    active: {
      type: Number,
      value: 0
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
      active:0,
      tabbar:[
        {
          "pagePath": "/pages/index/index",
          "text": "首页",
          "iconPath": "/images/tabbar/home_icon.png",
          "selectedIconPath": "/images/tabbar/home_icon_c.png"
        },
        {
          "pagePath": "/pages/follow/index",
          "text": "关注",
          "iconPath": "/images/tabbar/follow_icon.png",
          "selectedIconPath": "/images/tabbar/follow_icon_c.png"
        },
        {
          "pagePath": "/pages/preferred/index",
          "text": "优选",
          "iconPath": "/images/tabbar/yx_icon.png",
          "selectedIconPath": "/images/tabbar/yx_icon_c.png"
        },
        {
          "pagePath": "/pages/cart/index",
          "text": "购物车",
          "iconPath": "/images/tabbar/cart_icon.png",
          "selectedIconPath": "/images/tabbar/cart_icon_c.png"
        },
        {
          "pagePath": "/pages/wode/index",
          "text": "我的",
          "iconPath": "/images/tabbar/my_icon.png",
          "selectedIconPath": "/images/tabbar/my_icon_c.png"
        },
      ]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    toBar:function(e){
      console.log(e)
      var url=e.currentTarget.dataset.url
      if(url){
        wx.switchTab({
          url: url,
        })
      }else{
        wx.showToast({
          title: '敬请期待',
          icon:'none',
          duration:2000,

        })
      }
     
      
  },
  }
})